package com.ikan.positionserver.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

@Getter
@AllArgsConstructor
public enum RackTypeEnum {
    RACK("rack", "机柜"),
    PILLAR("pillar", "柱子"),


    ;
    //编码
    private String code;
    //描述
    private String desc;

    /***
     * 根据编码来获取枚举值
     * @param code
     * @return
     */
    public static final RackTypeEnum getByCode(String code) {
        for (RackTypeEnum tmpEnum : values()) {
            if (StringUtils.equalsIgnoreCase(tmpEnum.getCode(), code)) {
                return tmpEnum;
            }
        }
        return null;
    }
}
